package me.zhengjie.modules.website.service;

import me.zhengjie.modules.website.domain.ContentTable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import me.zhengjie.modules.website.domain.PageResult;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * @author system
 * @since 2024-09-26 16:41:54
 */
public interface  ContentTableService {

    PageResult<ContentTable> findPage(ContentTable params, LocalDateTime startDate, LocalDateTime endDate, Pageable pageable);

    PageResult<ContentTable> findLikeColumnId(ContentTable contentTable, LocalDateTime startDate, LocalDateTime endDate, Pageable pageable);

    List<ContentTable> findList(ContentTable params);

    ContentTable findById(Long id);

    ContentTable insert(ContentTable contentTable);

    ContentTable update(ContentTable contentTable);

    void delete(Long id);

    void incrementViewCount(Long contentId);

    void incrementLikeCount(Long contentId);

    Page<ContentTable> getContentsByColumnIds(String columnIds, Pageable pageable);

    Page<ContentTable> getContentsByColumnArray(String[] columnIds, Pageable pageable);

    Page<ContentTable> searchByTitle(String title, Pageable pageable);

    @Transactional
    void publishContent(Long id, Date releaseTime);

    @Transactional
    void revokeContent(Long id);

    @Transactional
    ContentTable addContent(ContentTable content);

    Page<ContentTable> searchByColumnAndTitle(Long columnId, String title, Pageable pageable);

    ContentTable updateContent(ContentTable contentTable);

    Page<ContentTable> getContentsByColumnIdsToTile(String columnIds, Pageable pageable);
}
